<!doctype html>
<html>
<head>
<meta charset="iso-8859-1">
<script src="/py_tokenizer.js"></script>
<script src="/py_utils.js"></script>
<script src="/py_classes.js"></script>
<script src="/py_list.js"></script>
<script src="/py_string.js"></script>
<script src="/py_dom.js"></script>
<script src="/py2js.js"></script>
<script src="/py_ajax.js"></script>

<script type="text/python">
ctag = DIV("smartphone",draggable=True,id="smart",Class="rounded-corners")
ctag.style= {'position':'absolute','left':100,'top':100,
    'width':80,'height':16}
ctag.ondragstart = drag_start
ctag.onmouseover = mouse_over
doc <= ctag

# drag and drop event handlers
doc.ondragover = drag_over
doc.ondrop = drop

def mouse_over(ev):
    ev.target.style.cursor = "pointer"
    
def drag_start(ev):
    ev.data['text']=ev.target.id
    ev.data.effectAllowed = 'move'
    
def drag_over(ev):
    ev.data.dropEffect = 'move'
    ev.preventDefault()
    
def drop(ev):
    ev.preventDefault()
    src_id = ev.data['text']
    elt = doc[src_id]
    elt.style.left = ev.x-elt.clientWidth/2
    elt.style.top = ev.y-elt.clientHeight/2
    elt.draggable = False # don't drag any more
    elt.style.cursor = "auto"


</script>
</head>
<body onload="brython(2)">
<div id="info" style="font-size:30px"></div>

</body>
</html>


